/*
 * DiskSpaceMonitor.h
 *
 *  Created on: 2017年2月4日
 *      Author: zhengboyuan
 */

#ifndef DISKSPACEMONITOR_H_
#define DISKSPACEMONITOR_H_

#include "BasicType.h"
#include <string>


class DiskSpaceMonitorListener
{
public:
	virtual ~DiskSpaceMonitorListener() {}

	virtual void onNotEnoughSpace(const std::string& dirpath, int64_t totalSpace, int64_t freeSpace, double percent) =0;

};


class DiskSpaceMonitor
{
public:
	static bool getDiskSpace(const std::string& dirpath, int64_t& totalSpace, int64_t& freeSpace);

public:
	virtual ~DiskSpaceMonitor() {}

	virtual void setListener(DiskSpaceMonitorListener* listener) =0;

	virtual int open() =0;

	virtual void close() =0;

	virtual bool isOpen() =0;

	virtual bool add(const std::string& dirpath, int64_t freeSpace) =0;

	virtual bool add(const std::string& dirpath, double freePercent) =0;

	virtual void clear() =0;

};

#endif /* DISKSPACEMONITOR_H_ */
